import { resRoutes } from '../testData/getroutes'
import { menuList } from '../testData/menu'

import request from '../axios'

function setParams(obj) {
  if (!obj) return ''
  let objList = Object.keys(obj)
  let str = ''
  objList.forEach((item, index) => {
    if (index == 0) {
      str += '?' + item + '=' + obj[item]
    } else {
      str += '&' + item + '=' + obj[item]
    }
  })
  return str
}

//登录
export const login = (data) => {
  // let obj = {
  //   msg: null,
  //   code: 0,
  //   data: {
  //     status: '认证成功',
  //     token: 'ADA59F01A10EF0A733735D7EF6002F42',
  //     username: 'wuzx'
  //   }
  // }
  // return new Promise((resolve, reject) => {
  //   resolve(obj)
  // })
  return request({
    url: '/tymhApi/login',
    method: 'post',
    data
  })
}
//注销
export const logout = () => {
  return request({ url: '/tymhApi/logout', method: 'get' })
}
//获取用户信息
export const getInfo = (data) => {
  // let obj = {
  //   code: 0,
  //   msg: null,
  //   data: {
  //     objectid: null,
  //     mobilePhone: '18317515076',
  //     orgCode: '10001',
  //     userEmail: '812019152@qq.com',
  //     userEmailPublic: 1,
  //     userLocked: '0',
  //     userName: '吴召欣',
  //     userSequence: '1',
  //     userSex: 'male',
  //     userType: '测试1',
  //     userUid: 'wuzx',
  //     deleteFlag: null,
  //     isSysuser: null,
  //     password: null
  //   }
  // }
  // return new Promise((resolve, reject) => {
  //   resolve(obj)
  // })
  return request({
    url: '/tymhApi/info',
    method: 'GET'
  })
}
//获取路由列表
export const getroutes = (data) => {
  // return new Promise((resolve, reject) => {
  //   resolve(resRoutes)
  // })
  return request({ url: '/tymhApi/getUserMenu', method: 'get' })
}
//获取菜单
export const getMenuList = (data) => {
  // return new Promise((resolve, reject) => {
  //   resolve(menuList)
  // })
  return request({ url: '/tymhApi/getMenuList', method: 'post', data })
}
//获取菜单树形结构
export const getUserMenuTreeSelect = (data) => {
  // return new Promise((resolve, reject) => {
  //   resolve(menuList)
  // })
  return request({ url: '/tymhApi/getUserMenuTreeSelect', method: 'post', data })
}
//更新令牌
export const updateToken = (data) => {
  return request({ url: '/tymhApi/updateToken', method: 'get' })
}
// ******************************************************************************************************
//获取用户列表
export const getUserList = (data) => {
  return request({ url: '/tymhApi/getUserList', method: 'post', data })
}
//获取组织列表
export const getOrgList = (data) => {
  return request({ url: '/tymhApi/getOrgList', method: 'post', data })
}
//获取组织树形结构
export const getOrgTreeSelect = () => {
  return request({ url: '/tymhApi/getOrgTreeSelect', method: 'GET' })
}
//获取角色列表（用户绑定角色下拉列表
export const getRoles = (data) => {
  return request({ url: '/tymhApi/getRoles', method: 'get' })
}
//修改用户角色绑定关系
export const updateUserRole = (data) => {
  return request({ url: '/tymhApi/updateUserRole', method: 'post', data })
}
//************************ */
//获取角色列表
export const getRoleList = (data) => {
  return request({ url: '/tymhApi/getRoleList', method: 'post', data })
}
//新增角色信息
export const addRole = (data) => {
  return request({ url: '/tymhApi/addRole', method: 'post', data })
}
//修改角色信息
export const updateRole = (data) => {
  return request({ url: '/tymhApi/updateRole', method: 'post', data })
}
//删除角色信息
export const deleteRole = (data) => {
  return request({ url: '/tymhApi/deleteRole', method: 'post', data })
}
//************************ */

//用户点击节点日志记录
export const saveLog = (data) => {
  return request({ url: '/tymhApi/saveLog', method: 'post', data })
}
//获取日志列表
export const getUserLog = (data) => {
  return request({ url: '/tymhApi/getUserLog', method: 'post', data })
}
//获取视频列表
export const getVideoList = (data) => {
  return request({ url: '/tymhApi/getVideoList', method: 'post', data })
}
//获取视频类型
export const getVideoTypeList = (data) => {
  return request({ url: '/tymhApi/getVideoTypeList', method: 'get', data })
}
//获取视频流
export const getVideoUrl = (data) => {
  return request({ url: '/tymhApi/getVideoUrl', method: 'post', data })
}
//获取报表列表
export const getReportList = (data) => {
  return request({ url: '/tymhApi/getReportList', method: 'post', data })
}
//************************ */
//修改菜单信息
export const updateMenu = (data) => {
  return request({ url: '/tymhApi/updateMenu', method: 'post', data })
}
//新增菜单
export const addMenu = (data) => {
  return request({ url: '/tymhApi/addMenu', method: 'post', data })
}
//删除菜单
export const deleteMenu = (data) => {
  return request({ url: '/tymhApi/deleteMenu', method: 'post', data })
}
// 事件预警列表
export const eventWarnList = (data) => {
  return request({ url: '/tymhApi/event/warn/list', method: 'post', data })
}


export const addUser = (data) => {
  return request({ url: '/umisSync/addUser', method: 'post', data })
}
export const addUserByOwner = (data) => {
  return request({ url: '/tymhApi/addUser', method: 'post', data })
}
export const delUser = (data) => {
  return request({ url: '/umisSync/delUser', method: 'post', data })
}


export const dxList = (data) => {
  return request({ url: '/tymhApi/message/list', method: 'post', data })
}


// 主题库
//表查询
export const tableManagerList = (data) => {
  return request({ url: '/tableManage/getTableManagePage', method: 'post', data })
}
//表结构查询
export const tableColsList = (data) => {
  return request({ url: 'tableManage/getColsByTableName', method: 'post', data })
}
// 获取任务对照表
export const cronList = (data) => {
  return request({ url: 'tableManage/getCronList', method: 'get', data })
}
//获取该表的任务详情
export const taskInfoById = (data) => {
  return request({ url: 'tableManage/getTaskInfoByTaskId', method: 'post', data })
}
// 暂停任务
export const taskPause = (data) => {
  return request({ url: 'tableManage/pauseTask', method: 'post', data })
}
// 恢复任务
export const taskResume = (data) => {
  return request({ url: 'tableManage/resumeTask', method: 'post', data })
}

// 更新任务
export const taskUpdate = (data) => {
  return request({ url: 'tableManage/updateTask', method: 'post', data })
}
export const BigSreenList = (data) => {
  return request({ url: 'tableManage/getSpecialSubjectModule ', method: 'post', data })
}
export const saveBigSrceenData = (data) => {
  return request({ url: 'tableManage/saveSpecialSubjectModule', method: 'post', data })
}

export const getBigSrceenById = (data) => {
  return request({ url: 'tableManage/getSpecialSubjectModuleByObjectId', method: 'post', data })
}
export const deleteBigScreenById = (data) => {
  return request({ url: 'tableManage/deleteSpecialSubjectModule', method: 'post', data })
}



